#include "dinner.h"
#include "ui_dinner.h"
#include "mainpage.h"

enum Day
{
    Mon,
    Tue,
    Wed,
    Thur,
    Fri,
    Sat
};

Dinner::Dinner(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Dinner)
{
    ui->setupUi(this);
    srand(time(0));
    ui->label_2->close();
    ui->label_3->close();
    ui->label_4->close();
    ui->label_5->close();
    ui->label_6->close();
    ui->label_7->close();
    ui->label_9->close();
    ui->label_10->close();
    int food_id=rand()%6;
    Printfood(food_id);
}

void Dinner::Printfood(int num)
{
    switch (num)
    {
    case 0:
        ui->label_2->show();
        break;
    case 1:
        ui->label_3->show();
        break;
    case 2:
        ui->label_4->show();
        break;
    case 3:
        ui->label_5->show();
        break;
    case 4:
        ui->label_6->show();
        break;
    case 5:
        ui->label_7->show();
        break;
    default:
        break;
    }
}

Dinner::~Dinner()
{
    delete ui;
}

void Dinner::on_pushButton_2_clicked()
{
    Mainpage *s = new Mainpage;
    s->show();
    this->close();
}

void Dinner::on_pushButton_clicked()
{
    int food_id=rand()%6;
    Printfood(food_id);
    ui->pushButton->setEnabled(false);
    ui->label_8->close();
    ui->label_9->show();
    ui->label_10->show();
}
